l = [1, 3, 2, 4, 3, 5, 6, 3, 100]

def func(l):
    if max(l) > len(l):
        return -1

    i = 0
    for a in range(0, len(l)-1):
        if l[i] in l[i+1:len(l)]:
            return l[i]

        else:
            i += 1


print(func(l))

# 方法2
def fun(nums):
    if max(l) > len(l):
        return -1
    for i in nums:
        if nums.count(i) >= 2:
            return i
    return -1

print(l.count(3))   # 统计列表中指定元素的重复出现次数（从一开始）

print(fun(l))


i = 0
a = [1, 2, 3, 4, 5]
for c in range(0, len(a)):
    i += 1
    del a[0:10]   # for中在此处对a进行修改无法影响len(a)

print(i)



a = 0
l = [1, 2, 3, 4, 5]
while a <= len(l):
    a += 1
    del l[0:3]   # 在while中修改l会影响判断处的len(l)

print(a)